<nz-modal [(nzVisible)]="isVisible" [nzWidth]="modalWidth" (nzOnCancel)="onBack()">
  <div *nzModalTitle>{{ title }}</div>
  <ng-container *nzModalContent>
    <form [formGroup]="dormitoryBuildingForm">
      <nz-row [nzGutter]="10">
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="name" nzRequired>楼栋名称</nz-form-label>
            <nz-form-control [nzErrorTip]="'请输入楼栋名称'">
              <input nz-input formControlName="name" placeholder="请输入楼栋名称" maxlength="32"/>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="constructionYear">建筑年份</nz-form-label>
            <nz-form-control>
            <nz-input-number formControlName="constructionYear" nzMin="1" nzMax="2100" />
            </nz-form-control>
          </nz-form-item>
        </nz-col>
      </nz-row>
      <nz-row [nzGutter]="10">
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="floorNumber" nzRequired>楼层</nz-form-label>
            <nz-form-control [nzErrorTip]="'请选择楼层'">
            <nz-input-number formControlName="floorNumber" nzMin="1" nzMax="127" />
            </nz-form-control>
          </nz-form-item>
        </nz-col>
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="buildingType" nzRequired>楼栋类型</nz-form-label>
            <nz-form-control [nzErrorTip]="'请选择楼栋类型'">
              <nz-select formControlName="buildingType">
                <nz-option nzLabel="男生" [nzValue]="1"></nz-option>
                <nz-option nzLabel="女生" [nzValue]="2"></nz-option>
                <nz-option nzLabel="按楼层男女混住" [nzValue]="3"></nz-option>
              </nz-select>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
      </nz-row>
      <nz-row [nzGutter]="10">
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="staffName" nzRequired>宿管姓名</nz-form-label>
            <nz-form-control [nzErrorTip]="'请选择宿管姓名'">
              <nz-input-group nzSearch [nzAddOnAfter]="suffixIconButton">
                <input nz-input formControlName="staffName" placeholder="请选择宿管姓名" readonly />
              </nz-input-group>
              <ng-template #suffixIconButton>
                <button nz-button nzType="primary" nzSearch (click)="findStaff()"><nz-icon nzType="search" /></button>
              </ng-template>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="buildingLocation">位置</nz-form-label>
            <nz-form-control>
              <input nz-input formControlName="buildingLocation" placeholder="请输入位置" maxlength="255"/>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
      </nz-row>
    </form>
  </ng-container>
  <div *nzModalFooter>
    <div class="form-button-container">
      <button nz-button nzType="primary" (click)="onSave()" [nzLoading]="saveLoading">保存</button>
      <button nz-button nzType="default" (click)="onReset()" [nzLoading]="saveLoading">重置</button>
      <button nz-button nzType="default" (click)="onBack()">关闭</button>
    </div>
  </div>
</nz-modal>
<staff-selector (staffSelectedEvent)="handleStaffSelectedEvent($event)"></staff-selector>
